# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=display-switch
pkgver=1.1.0
pkgrel=1
pkgdesc="utility for switching displays over DDC/CI on USB disconnect/connect events"
url="https://github.com/haimgel/display-switch"
arch="all !s390x !riscv64"  # no rust
license="MIT"
makedepends="cargo eudev-dev libusb-dev"
install="$pkgname.pre-install"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/haimgel/display-switch/archive/$pkgver.tar.gz
	50-i2c.rules
	"

build() {
	cargo build --release --locked
}

check() {
	cargo test --release --locked
}

package() {
	cargo install --locked --path . --root="$pkgdir/usr"
	rm "$pkgdir"/usr/.crates*

	install -Dm644 "$srcdir"/50-i2c.rules \
		"$pkgdir"/lib/udev/rules.d/50-i2c.rules
}

sha512sums="
d5d347ff425f5dfcbebccb1a778607fbf5b1d6c35fef85772523594239685294fddd9d4decd3a7c4bfe093cd0c144cad45710f6c89adb17d53c635bac8672da0  display-switch-1.1.0.tar.gz
b2c9d0bf35b75f4b52f9db9e243912d356e224afac55348c9702349b74d603d3c659b22f808e59f2e8e45d605c8c244d7c07484186a31e7a3fe3ca72a1715e1e  50-i2c.rules
"
